1 <table height="28" cellSpacing="0" cellPadding="0" width="100%" border="0">
2       <tr align=center>
3         <td
class="title" width="100%">Trợ giúp: <a href="./?act=help_m&page=<? echo $_REQUEST['page']?>&cat=<? echo $_REQUEST['cat']; ?>"><font class="V10pt" color="#ffffff">Nh&#7853;p M&#7899;i</font></a>&nbsp;&nbsp;
4     </td>
5       </tr>
6     </table>
7 <?
8 $MAXPAGE=
20;
9
10     
switch ($_GET['action'])
11     {
12         
case 'del' :
13             $id = $_GET[
'id'];
14             $news=GetHelpInfo($id);
15             
if ($news)
16             {
17                 $sql =
"delete from help where id='".$id."'";
18                 $result = mysql_query($sql,$con);
19                 
if ($result)
20                 {
21                     
if (file_exists("../".$news['image'])) unlink("../".$news['image']);
22                     echo
"<p align=center class='err'>&#272;ã xóa thành công</p>";
23                 }
24                     
else echo "<p align=center class='err'>Không th&#7875; xóa d&#7919; li&#7879;u</p>";
25             }
26             
break;
27     }
28 ?>
29
30 <?
31     
if (isset($_POST['ButDel'])) {
32         $cnt=
0;
33         
foreach ($_POST['chk'] as $id)
34         {
35             $news=GetHelpInfo($id);
36             
if ($news)
37             {
38                 @$result = mysql_query(
"delete from help where id='".$id."'",$con);
39                 
if ($result) {
40                     $cnt++;
41                     
if (file_exists("../".$news['image'])) unlink("../".$news['image']);
42                 }
43             }
44         }
45         echo
"<p align=center class='err'>&#272;ã xóa ".$cnt."</p>";
46     }
47 ?>
48 <?
49     
if (isset($_POST['ButHot'])) {
50         $cnt=
0;
51         
foreach ($_POST['chk'] as $id)
52         {
53             $pro=GetHelpInfo($id);
54             
if ($pro)
55             {
56                 
if (CountRecord("news_hot","news_id=".$pro['news_id'])<=0)
57                 {
58                     $result = mysql_query(
"insert into news_hot (news_id,ns_dateadded) values ('".$pro['news_id']."',SYSDATE())",$con);
59                     
if ($result) {
60                         $cnt++;
61                     }
62                 }
63             }
64         }
65         echo
"<p align=center class='err'>&#272;ã c&#7853;p nh&#7853;t ".$cnt." ph&#7847;n t&#7917;</p>";
66     }
67 ?>
68
69 <?
70     $page = $_GET[
"page"];
71     $p=
0;
72     
if ($page!='') $p=$page;
73     $
where="1=1";
74     
if ($_REQUEST['cat']!='') $where="cat_id=".$_REQUEST['cat'];
75 ?>
76 <form method=
"POST" name="frmList" action="index.php">
77 <input type=
"hidden" name="act" value="help">
78 <input type=hidden name=
"page" value="<? echo $_REQUEST['page']; ?>">
79 <?
80 function taotrang($sql,$link,$nitem,$itemcurrent)
81 {
global $con;
82     $ret=
"";
83     $result = mysql_query($sql, $con) or die(
'Error' . mysql_error());
84     $
value = mysql_fetch_array($result);
85     $plus = (($
value['cnt'] % $nitem)>0);
86     
for ($i=0;$i<($value[0] / $nitem) + plus;$i++)
87     {
88         
if ($i<>$itemcurrent) $ret .= "<a href=\"".$link.$i."\" class=\"lslink\">".($i+1)."</a> ";
89         
else $ret .= ($i+1)." ";
90     }
91     
return $ret;
92 }
93     $pageindex=taotrang(
"select count(*) from help where $where","./?act=".$_REQUEST['act']."&cat=".$_REQUEST['cat']."&sortby=".$_REQUEST['sortby']."&direction=".$_REQUEST['direction']."&page=",$MAXPAGE,$page);
94 ?>
95
96 <table cellspacing=
"0" cellpadding="0" width="100%">
97 <?
if ($_REQUEST['code']==1) echo '<tr><td colspan=2 align="center" class="err">&#272;ã c&#7853;p nh&#7853;t thành công</td></tr>'; ?>
98 <tr>
99 <td
class="smallfont">Trang : <? echo $pageindex; ?></td>
100 <td height=
"30" align="right" class="smallfont">
101     <
select size="1" name="ddCat" class="smallfont">
102 <?
103     $ms=GetListCatHelp(
0);
104     echo
'<option value="">[T&#7845;t c&#7843;]</option>';
105     
foreach ($ms as $m)
106         
if ($m[0]!=$_REQUEST['cat'])
107             echo
'<option value="'.$m[0].'">'.$m[1].'</option>';
108         
else
109             echo
'<option selected value="'.$m[0].'">'.$m[1].'</option>';
110 ?>
111     </
select>
112     <input type=
"button" value="Chuy&#7875;n" class="button" onclick="window.location='./?act=help&cat='+ddCat.value">
113     </td>
114 </tr>
115 </table>
116
117 <?
118 function GetLinkSort($order)
119 {
120     $direction=
"";
121     
if ($_REQUEST['direction']==''||$_REQUEST['direction']!='0')
122         $direction=
"0";
123     
else
124         $direction=
"1";
125     
126     
return "./?act=".$_REQUEST['act']."&cat=".$_REQUEST['cat']."&page=".$_REQUEST['page']."&sortby=".$order."&direction=".$direction;
127 }
128 ?>
129
130 <table border=
"1" cellpadding="2" style="border-collapse: collapse" bordercolor="#C9C9C9" width="100%" id="AutoNumber1">
131   <tr>
132     <td align=center nowrap
class="title"><input type="checkbox" name="chkall" onclick="chkallClick(this);"></td>
133     <td colspan=
"2" nowrap class="title">&nbsp;</td>
134     <td align=
"center" nowrap class="title"><a class="title" href="<? echo GetLinkSort(1); ?>"><b>Mã</b></a></td>
135     <td align=
"center" nowrap class="title"><a class="title" href="<? echo GetLinkSort(2); ?>"><b>Tiêu &#273;&#7873;</b></a></td>
136     <td align=
"center" nowrap class="title"><a class="title" href="<? echo GetLinkSort(2); ?>"><b>S&#7889; th&#7913; t&#7921;</b></a></td>
137     <td align=
"center" nowrap class="title"><a class="title" href="<? echo GetLinkSort(3); ?>"><b>Hình</b></a></td>
138 <!--
139     <td align=
"center" nowrap class="title"><b>N&#7897;i dung ng&#7855;n</b></td>
140     <td align=
"center" nowrap class="title"><b>N&#7897;i dung</b></td>
141 -->
142     <td align=
"center" nowrap class="title"><a class="title" href="<? echo GetLinkSort(7); ?>"><b>Ngày</b></a></td>
143     <td align=
"center" nowrap class="title"><a class="title" href="<? echo GetLinkSort(9); ?>"><b>Danh m&#7909;c</b></a></td>
144   </tr>
145   
146   <?
147             $sortby=
"order by thutu";
148             
if ($_REQUEST['sortby']!='') $sortby="order by ".(int)$_REQUEST['sortby'];
149             $direction=($_REQUEST[
'direction']==''||$_REQUEST['direction']=='0'?"desc":"");
150             $sql=
"select * from help where $where $sortby $direction limit ".($p*$MAXPAGE).",".$MAXPAGE;
151             $result=mysql_query($sql,$con);
152             $i=
0;
153             
while(($row=mysql_fetch_array($result)))
154             {
155             $i++;
156             
if ($i%2) $color="#d5d5d5"; else $color="#e5e5e5";
157             $sql_cat=mysql_query(
"SELECT * FROM help_cat where id='".$row['cat_id']."' ");
158             $row_cat=mysql_fetch_array($sql_cat);
159   ?>
160   
161   <tr>
162     <td align=
"center" bgcolor="<? echo $color; ?>" class="smallfont">
163     <input type=
"checkbox" name="chk[]" value="<? echo $row['id']; ?>"></td>
164     <td align=
"center" bgcolor="<? echo $color; ?>" class="smallfont">
165     <a href=
"./?act=help_m&cat=<? echo $_REQUEST['cat']; ?>&id=<? echo $row['id']; ?>&page=<? echo $_REQUEST['page'];?>">S&#7917;a</a></td>
166     <td align=
"center" bgcolor="<? echo $color; ?>" class="smallfont">
167     <a onclick=
"return confirm('B&#7841;n có ch&#7855;c ch&#7855;n mu&#7889;n xoá ?');" href="./?act=help&action=del&cat=<? echo $_REQUEST['cat']; ?>&id=<? echo $row['id']; ?>">Xóa</a></td>
168     <td bgcolor=
"<? echo $color; ?>" align="left" align="left" class="smallfont"><? echo $row['id']; ?>&nbsp;</td>
169     <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $row['name']; ?>&nbsp;</td>
170     <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $row['thutu']; ?>&nbsp;</td>
171     <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $row['image']; ?>&nbsp;</td>
172     <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $row['date']; ?>&nbsp;</td>
173     <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $row_cat['name']; ?>&nbsp;</td>
174   </tr>
175   <?
176                 }
177   ?>
178 </table>
179 <table border=
"0" width="100%" cellspacing="0" cellpadding="0" id="table1">
180     <tr>
181         <td>
182 <input type=
"submit" value="Xóa Ch&#7885;n" name="ButDel" onclick="return confirm('B&#7841;n có ch&#7855;c ch&#7855;n mu&#7889;n xoá ?');" class="button"></td>
183     </tr>
184 </table>
185 </form>
186 <script language=
"JavaScript">
187 function chkallClick(o) {
188     
var form = document.frmList;
189     
for (var i = 0; i < form.elements.length; i++) {
190         
if (form.elements[i].type == "checkbox" && form.elements[i].name!="chkall") {
191             form.elements[i].
checked = document.frmList.chkall.checked;
192         }
193     }
194 }
195 </script>



Full source code website bán hàng thương mại điện tử gần giống shopee 468.841 lượt xem

Gõ tìm kiếm nhanh...